package com.elecbook.rpc.feignclient.fallback;

import com.elecbook.auth.model.po.User;
import com.elecbook.base.result.Result;
import com.elecbook.rpc.feignclient.UserServiceClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;


@Slf4j
@Component
public class AuthServiceClientFallbackFactory implements FallbackFactory<UserServiceClient> {
    @Override
    public UserServiceClient create(Throwable throwable) {
        return new UserServiceClient() {
            @Override
            public Result<List<User>>  getUserInfoByIds(List<Integer> ids) {
                log.error("出现错误getUserInfoByIds: {}", ids);
                return null;
            }
        };
    }
}